package com.cqemme.comm.po;

import com.cqemme.comm.utils.JackSonUtils;
import com.cqemme.comm.utils.ResultCodeMsg;
import lombok.extern.slf4j.Slf4j;

/**
 * 主要用作连接超时工具类
 * @author amkj
 */
@Slf4j
public class ConnectTimeoutResult {

    public static Result timeoutResult(Throwable throwable){
        Result result = new Result();
        result.setStatusCode(ResultCodeMsg.CODE_506);
        if(throwable != null){
            log.error(throwable.getMessage());
            result.setError(throwable.getMessage());
        }
        return  result;
    }


    public static String timeoutResultString(Throwable throwable){
        Result result = timeoutResult(throwable);
        return  JackSonUtils.beanToString(result);
    }

}
